本文共 1078 字,大约阅读时间需要 3 分钟。
var data = { "id": "1280", "name": "漂亮的衣服", "price": "100", "oprice": "150", "goods_img": [ "http://image.diandodo.com/zhudianbao/Uploads/User/u1250000189/20160718/a/578c97464f436.jpg@1000w", "http://image.diandodo.com/zhudianbao/Uploads/User/u1250000189/20160718/d/578c973b1fa40.jpg@1000w", "http://image.diandodo.com/zhudianbao/Uploads/User/u1250000189/20160718/6/578c973352e0f.jpg@1000w" ] };
{ {= it.name}}
方式1
{ { for(var prop in it['goods_img']) { }}{ { } }}
方式2
{ {~ it.goods_img:v}}{ {~}}
方式3
{ { for(var prop in it['goods_img']) { }}{ { var v = it['goods_img'][prop]; }}{ { } }}
var interText = doT.template($("#goodstmpl").text());$("#info_area").html(interText(data));
小结
很好用~
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5949852.html,如需转载请自行联系原作者